//
//  AppDelegate.m
//  JoinPeso
//
//  Created by 小琦 on 2024/11/18.
//

#import "AppDelegate.h"
#import "XQHomeTabBarController.h"
#import "ViewController.h"
#import "XQWelcomeController.h"
#import "XQNavigationController.h"
#import "XQLoginInitModel.h"
#import "XQAlertController.h"
#import "XQShowCoverController.h"
#import <AdSupport/ASIdentifierManager.h>
#import <AppTrackingTransparency/AppTrackingTransparency.h>

@interface AppDelegate ()
@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = UIColor.whiteColor;
    
    XQShowCoverController *vc = [XQShowCoverController new];
    vc.launchOptions = launchOptions;
    self.window.rootViewController = [[XQNavigationController alloc] initWithRootViewController:vc];
    [self.window makeKeyAndVisible];
            
    return YES;
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    if (@available(iOS  14, *)) {
        [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
            NSString *idfa = [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString];
            [[NSUserDefaults standardUserDefaults] setObject:idfa forKey:KXQTrackingInfo];
        }];
    }
}


@end
